#ifndef KOCH_H
#define KOCH_H

#include "../element/point.h"
#include "../element/box.h"
#include "fractal.h"

class Koch : public Fractal
{
public:
    Koch();
    Koch(Box& box, Point &pt, double r, int l = 0);
    ~Koch();

    virtual void generate();

    virtual void draw();

    virtual void drawLattice();

    virtual void drawSeed();

    Interval evalDM(Box &box, int level);
    Interval evalFang(Box &box, int level);

    Interval evalLattice(Box &box);


    double evalFang(Point& pt, Point& c, double r, int level);
    double evalDM(Point& pt, Point& c, double r, int level);

    double baseFunc(Point &pt, Point& c, double r);
    double baseFunc2(Point &pt, Point& c, double r);

    double patternKoch(Point& pt, double r);
    double evenCircle(Point& pt, double r);
    double oddCircle(Point& pt, double r);

protected:
    void generateFang(Box& box, int level);
    void generateDM(Box& box, int level);
    void generateLattice();

protected:
    Point ct;       // center point
    double radius;  // radius
    Box bbox;
    int level;
    std::vector<Box> allBoxes;
    std::vector<Box> latticeBoxes;
    bool quitThread;
};

#endif // KOCH_H
